// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import { SHA1 } from './assets/SHA1.js'
import verify from 'vue-verify-plugin'
import store from '../store/index.js'
import 'element-ui/lib/theme-chalk/index.css'
import ElementUI from 'element-ui'
import VueLazyLoad from 'vue-lazyload'

Vue.use(ElementUI )
Vue.use(VueLazyLoad,{
	error:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1526539258152&di=bafbbdafe1835b6b302054bb327d74ec&imgtype=0&src=http%3A%2F%2Fpic002.cnblogs.com%2Fimages%2F2012%2F17329%2F2012032422032367.gif',
	loading:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1526539119677&di=2875936c4706c32de109e184f8b91d9f&imgtype=0&src=http%3A%2F%2Fimg.mp.itc.cn%2Fupload%2F20161007%2Fb6a4693671ea41dbbe48a546411eab21.jpg',
	effectFadeIn: true,
	attempt: 1,   //尝试次数
})
Vue.use(verify,{blur:true})

Vue.config.productionTip = false
// axios 全局默认请求地址配置
let now = Date.now();
let appKey = SHA1("A6078709677498"+"UZ"+"5FDAFB89-E015-8F2D-ED29-2853B43DBF78"+"UZ"+now)+"."+now;

// axios.defaults.baseURL = "https://d.apicloud.com/mcm/"
axios.defaults.headers['X-APICloud-AppId'] = "A6078709677498"
axios.defaults.headers['X-APICloud-AppKey'] = appKey
Vue.prototype.$http = axios


/* eslint-disable no-new */
new Vue({
	el: '#app',
	router,
	store, //使用store 管理状态
	components: { App },
	template: '<App/>'
})


/*
   to:要去的路由
   from：从哪来的
   next()：函数--执行下一步操作
   */
// router.beforeEach((to,from,next) => {
// 	// console.log(to,from);
// 	if (to.path === "/login" || to.path === "/regist") {
// 		next();
// 	}else{
// 		alert("您还没有登录，请先登录！")
// 		next('/login')
// 	}
// })
